if [ -z "$CONFIG_FILE" ]; then
	echo "CONFIG_FILE should be set"
	exit 1
fi
eval $(awk '
BEGIN { FS = ": "; RS = "\n"; }
{
    gsub(/^[ \t]+|[ \t]+$/, "", $1);
    gsub(/^[ \t]+|[ \t]+$/, "", $2);
    if ($1 ~ /^[a-zA-Z_][a-zA-Z0-9_]*$/) {
        print toupper($1) "=" "\"" $2 "\"";
    }
}
' "$CONFIG_FILE")

ALL_IP_0_1=$(awk '
BEGIN { RS = "[\n]"; FS = ":"; }
/all_ip:/ {
    getline;
    sub(/^[ \t]+-\s*\[/, "");
    sub(/\].*$/, "");
    split($0, ips, ", ");
    for (i in ips) {
        gsub(/"/, "", ips[i]);
        if (i == 2) {
            print ips[i];
            exit;
        }
    }
}
' "$CONFIG_FILE")

IPS=$(awk '
BEGIN { RS = "[\n]"; FS = ":"; }
/all_ip:/ {
    while (getline) {
        if ($0 ~ /^\s+-/) {
            gsub(/^[ \t]+-\s*\[/, "");
            gsub(/\]\s*$/, "");
            split($0, ip_pair, ", ");
            gsub(/"/, "", ip_pair[1]);
            gsub(/"/, "", ip_pair[2]);
            print ip_pair[1] " " ip_pair[2];
        } else {
            break;
        }
    }
}
' "$CONFIG_FILE")